package cn.corffen.test.algorithm.leetcode.easy;

public class Question104 {

    public static void main(String[] args) {

    }

    public int maxDeep(TreeNode node) {
        if (node == null) {
            return 0;
        } else {
            int left_height = maxDeep(node.left);
            int right_height = maxDeep(node.right);
            return Math.max(left_height, right_height) + 1;
        }
    }

//    public int maxDepth(TreeNode root) {
//        Queue<Pair<TreeNode, Integer>> queue = new Queue<>();
//        if (root != null) {
//            queue.enqueue(new Pair<TreeNode, Integer>(root, 1));
//        }
//        int depth = 0;
//        while (!queue.isEmpty()) {
//            Pair<TreeNode, Integer> current = queue.dequeue();
//            root = current.getKey();
//            int current_depth = current.getValue();
//
//            if (root != null) {
//                depth = Math.max(depth, current_depth);
//                queue.enqueue(new Pair<TreeNode, Integer>(root.left, current_depth + 1));
//                queue.enqueue(new Pair<TreeNode, Integer>(root.right, current_depth + 1));
//            }
//        }
//        return depth;
//    }


    private static class TreeNode {
        int val;
        private TreeNode left;
        private TreeNode right;

        public TreeNode(int val) {
            this.val = val;
        }
    }
}
